package com.ai.controller.made;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.entity.made.page.ModbusServerInfoPage;
import com.ai.entity.made.page.OpcServerInfoPage;
import com.ai.model.dto.ModbusServerInfoDto;
import com.ai.model.dto.OpcServerInfoDto;
import com.ai.service.made.IModbusServerInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * modbus通信服务
 * @author jiaok
 * @since 2024-11-26
 */
@RestController
@RequestMapping("/modbus-server-info")
public class ModbusServerInfoController {


    @Resource
    private IModbusServerInfoService iModbusServerInfoService;

    @ApiOperation("modbus设备分页")
    @PostMapping("pageList")
    @EnterPathParamLog
    public IPage selectByPage(@RequestBody ModbusServerInfoPage page) {
        return   iModbusServerInfoService.selectByPage(page);
    }

    @ApiOperation("新增modbus服务")
    @PostMapping("add")
    @EnterPathParamLog
    public CommonResponse<String> add(@RequestBody ModbusServerInfoDto modbusServerInfoDto){
        return iModbusServerInfoService.add(modbusServerInfoDto);
    }

    @ApiOperation("删除modbus服务")
    @PostMapping("delete/{id}")
    @EnterPathParamLog
    public CommonResponse<String> delete(@PathVariable(value = "id") String id ){
        return iModbusServerInfoService.delete(id);
    }

    @ApiOperation("修改modbus服务")
    @PostMapping("edit")
    @EnterPathParamLog
    public CommonResponse<String> edit(@RequestBody  ModbusServerInfoDto modbusServerInfoDto){
        return iModbusServerInfoService.edit(modbusServerInfoDto);
    }


}
